<?php /* Smarty version 2.6.20, created on 2016-07-19 15:10:58
         compiled from product_sell_amount.htm */ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>产品销量统计</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<link href="cxcalendar.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script language="javascript" src="../script/Calendar-new.js"></script>
</head>
<body>
<div class="container">
    <div class="flow">
        <div class="itemtitle">
            <h3>产品销量统计</h3>
            <ul>
                <li class="current"><a href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
"><span>管理</span></a></li>
			</ul>
			<ul style="float:right;">
                <li>
                    <form method="post" target="export_sell_iframe" id="export_sell_iframe" action=""><input type="hidden" value="export_sell" name="act"/></form>
                    <iframe src="" style="display:none;" id="export_sell_iframe" name="export_sell_iframe"></iframe>
                    <a href="javascript:;" onclick="$('#export_sell_iframe').submit();"><span>导出销量数据</span></a>
                </li>
            </ul>
        </div>
    </div>
    <div class="h35"></div>
    <form action="" method="get">
    <input type="hidden" name="m" value="<?php echo $_GET['m']; ?>
">
    <input type="hidden" name="s" value="<?php echo $_GET['s']; ?>
">
    <table class="select_table">
        <tr>    
            <td>
            	<div class="select_box">
            		<span style="float:left;">仓库：</span><select name="stock_shop" id="stock_shop" style="float:left;">
                <option value="" <?php if ($this->_tpl_vars['general_shop'] != 0): ?>disabled<?php endif; ?>>全部</option>
                <?php $_from = $this->_tpl_vars['stock_shops']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                <option value="<?php echo $this->_tpl_vars['list']['id']; ?>
" <?php if ($_GET['stock_shop'] == $this->_tpl_vars['list']['id']): ?>selected<?php endif; ?> <?php if ($this->_tpl_vars['general_shop'] != 0 && $this->_tpl_vars['general_shop'] != $this->_tpl_vars['list']['id']): ?>disabled<?php endif; ?>><?php echo $this->_tpl_vars['list']['title']; ?>
</option>
                
                <?php endforeach; endif; unset($_from); ?>
                </select>
                </div>
                <span>&nbsp;&nbsp;&nbsp;&nbsp;下单时间：</span>
                <span>
                        <input class="w120 input_cxcalendar" type="text" name="stime" id="stime" value="<?php echo $_GET['stime']; ?>
"">
                        -
                        <input class="w120 input_cxcalendar" type="text" name="etime" id="etime" value="<?php echo $_GET['etime']; ?>
"">
                </span>
                <div style="display:inline-block;">
                	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="搜索" />
                	<a class="refresh" href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
"></a>
                </div>
           </td>
        </tr>
    </table>
    </form>
    <table class="table product">
       <tbody>
       <tr class="header">
            <th width="50">商品ID</th>
            <th width="50">SKU_ID</th>
            <th width="60">条码code</th>
            <th width="80">商品图片</th>
            <th width="130">商品名称</th>
            <th width="60">商品规格</th>
            <th width="100">分销价</th>
            <th width="100">零售价</th>
            <th width="100">最低采购价</th>
            <th width="100">平均采购价</th>
            <th width="100">供应价</th>
            <th width="60">实际库存</th>
            <th width="60">虚拟库存</th>
            <th width="60">限购数量</th>
            <th width="100">销售数量</th>
            <th></th>
        </tr>
        <?php $_from = $this->_tpl_vars['de']['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
        <tr>
            <td><?php echo $this->_tpl_vars['list']['pid']; ?>
</td>
            <td><?php echo $this->_tpl_vars['list']['product_id']; ?>
</td>
            <td><?php echo $this->_tpl_vars['list']['barcode']; ?>
</td>
            <td><a href="<?php echo $this->_tpl_vars['list']['pic']; ?>
" target="_blank"><img src="<?php echo $this->_tpl_vars['list']['pic']; ?>
/80" alt="" /></a></td>
            <td><?php echo $this->_tpl_vars['list']['product_name']; ?>
</td>
            <td><?php echo $this->_tpl_vars['list']['property']; ?>
</td>
            <td><?php echo $this->_tpl_vars['config']['money']; ?>
<?php echo $this->_tpl_vars['list']['dis_price']; ?>
</td>
            <td><?php echo $this->_tpl_vars['config']['money']; ?>
<?php echo $this->_tpl_vars['list']['price']; ?>
</td>
            <td><?php echo $this->_tpl_vars['list']['min_realpricebuy']; ?>
 <?php echo $this->_tpl_vars['list']['currency_unit']; ?>
</td>
            <td><?php echo $this->_tpl_vars['list']['avg_realpricebuy']; ?>
 <?php echo $this->_tpl_vars['list']['currency_unit']; ?>
</td>
            <td><?php echo $this->_tpl_vars['list']['pricebuy']; ?>
 <?php echo $this->_tpl_vars['list']['currency_unit']; ?>
</td>
            <td><?php echo $this->_tpl_vars['list']['stocks']; ?>
</td>
            <td><?php echo $this->_tpl_vars['list']['canbuyout']; ?>
</td>
            <td><?php echo $this->_tpl_vars['list']['buy_limit']; ?>
</td>
            <td style="color:red;"><?php echo $this->_tpl_vars['list']['total_num']; ?>
</td>
            <td><button class="history_button" productid="<?php echo $this->_tpl_vars['list']['product_id']; ?>
" shopid="<?php echo $this->_tpl_vars['list']['stock_shop']; ?>
">历史采购</button></td>
        </tr>
        <?php endforeach; else: ?>
        <tr>
            <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
        </tr>
        <?php endif; unset($_from); ?>
		</tbody>
        <tfoot>
            <tr>
                <td colspan="99">
                	<div class="fl">每页最多显示： 20条</div>
                    <div class="page"><?php echo $this->_tpl_vars['de']['page']; ?>
</div>
                    <div class="fr">共有<?php echo $this->_tpl_vars['de']['count']; ?>
条记录</div>
                </td>
            </tr>
        </tfoot>
    </table>
<script>
//查看采购历史
$('.history_button').click(function(){
	var productid = $(this).attr('productid');
	var shopid = $(this).attr('shopid');
	window.parent.iframe_form("purchases", '历史采购', 'module.php?m=inventory&s=historyPurchases.php&id='+productid+'&shopid='+shopid, 1000, 600);
	return false;
});

//时间搜索
$('.input_cxcalendar').each(function(){
    var a = new Calendar({
        targetCls: $(this),
        type: 'yyyy-mm-dd HH:MM:SS',
        wday:2
    },function(val){
        console.log(val);
    });
});
</script>    
</div>
</body>
</html>